home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-04-24 | 2.3 KB | 97 lines | [TEXT/MPS ] |
- program Fish;
- {$D+} {put in debug names}
- {$R+} {range checking on}
- {$OV+} {overflow checking on}
- {$N+} {pass routine names to linker, so they're not anonymous}
- USES {$LOAD pinterfaces.dump}
- MemTypes,QuickDraw,OsIntf,PasLibIntf,ToolIntf,
- PackIntf,IntEnv,CursorCtl,
- {$LOAD}
- {$U UDrag.p} DragManager;
-
- var
- myPic : PicHandle;
- myRect : Rect;
- wPort: GrafPtr;
- whichPict,
- x,y,xinc,yinc : integer;
- xyPt, lastXYPt : point;
- myEventRecord : EventRecord;
- lastCount : longint;
-
- myDragStuff : DragHandle;
-
- procedure SwimItAround;
- const
- CapsLockBit = 10;
- var
- hOffset : integer;
- mousingRgn : RgnHandle;
- mousePt: Point;
- begin
- with shadowStuff do
- begin dx := 0; dy := 0; visible := false; end;
- with myPic^^.picFrame do
- SetPt( lastXYPt, left-right, screenBits.bounds.bottom-(bottom-top) div 2 );
- xyPt := lastXYPt;
- hOffset := 2;
- mousingRgn := NewRgn;
- CopyRgn( myDragStuff^^.thePictureRgn, mousingRgn );
- OffsetRgn( mousingRgn, -mousingRgn^^.rgnBBox.left,
- -mousingRgn^^.rgnBBox.top);
- OffsetRgn( mousingRgn, xyPt.h, xyPt.v );
- repeat
- if button then
- begin
- GetMouse( mousePt );
- LocalToGlobal( mousePt );
- if PtInRgn( mousePt, mousingRgn) then hOffset := 20;
- end;
- xyPt.h := xyPt.h + hOffset;
- xyPt.v := xyPt.v + (Random div 30000);
- OffsetRgn( mousingRgn, -mousingRgn^^.rgnBBox.left,
- -mousingRgn^^.rgnBBox.top);
- OffsetRgn( mousingRgn, xyPt.h, xyPt.v );
-
- DragItTo( myDragStuff, xyPt, false );
- lastXYPt := xyPt;
- {allow for FKEY access and give DAs and such time}
- if GetNextEvent( keyDownMask, myEventRecord ) then {do nothing};
- SystemTask;
- until xyPt.h > screenBits.bounds.right
- + myPic^^.picFrame.right-myPic^^.picFrame.left;
- end; {dragitaround}
-
- begin{main}
- InitGraf(@thePort);
-
- {standalones need to init windows, but tools shouldn't}
- if IEStandalone then InitWindows;
-
- GetWMgrPort( wPort );
- SetPort( wPort );
- ClipRect( screenBits.bounds );
-
- if not InitDrag( nil ) then exit( Fish );
-
- myPic := GetPicture(197);
- if myPic = nil then
- begin SysBeep(1); exit(Fish); end;
- {change up the default shadow stuff}
- with shadowStuff do
- begin
- thePattern := gray;
- copyMode := SrcOr;
- end;
-
- if not NewDraggable( myPic, nil, nil, myDragStuff )
- then exit(Fish);
- SwimItAround;
- DisposeDraggable( myDragStuff );
- ReleaseResource( Handle( myPic ));
-
- CloseDrag( true );
- FlushEvents( everyEvent, 0 );
-
- end.
-